<template>
	<el-main class="bg edit_wrap comtable_e">
		<el-form ref="form" :model="form" status-icon label-width="120px" v-if="is_view()">
		<el-row class="row_ce"> 
							<el-col v-if="$check_field('get','project_manager') || $check_field('add','project_manager') || $check_field('set','project_manager')" :xs="24" :sm="12" :lg="8" class="el_form_item_warp">
							<el-form-item label="项目经理" prop="project_manager">
																					<div v-if="user_group !== '管理员'">
							{{ get_user_session_project_manager(form['project_manager']) }}
							<el-select v-if="(form['task_allocation_id'] && $check_field('set','project_manager')) || (!form['task_allocation_id'] && $check_field('add','project_manager'))" id="project_manager" v-model="form['project_manager']" :disabled="disabledObj['project_manager_isDisabled']">
								<el-option v-for="o in list_user_project_manager" :key="o['username']" :label="o['nickname'] + '-' + o['username']"
										   :value="o['user_id']">
								</el-option>
							</el-select>
							<el-select v-else-if="$check_field('get','project_manager')" id="project_manager" v-model="form['project_manager']" :disabled="true">
								<el-option v-for="o in list_user_project_manager" :key="o['username']" :label="o['nickname'] + '-' + o['username']"
										   :value="o['user_id']">
								</el-option>
							</el-select>
						</div>
						<el-select v-else id="project_manager" v-model="form['project_manager']" :disabled="disabledObj['project_manager_isDisabled']">
							<el-option v-for="o in list_user_project_manager" :key="o['username']" :label="o['nickname'] + '-' + o['username']"
									   :value="o['user_id']">
							</el-option>
						</el-select>
																</el-form-item>
			</el-col>
								<el-col v-if="$check_field('get','development_receiving') || $check_field('add','development_receiving') || $check_field('set','development_receiving')" :xs="24" :sm="12" :lg="8" class="el_form_item_warp">
							<el-form-item label="开发接收" prop="development_receiving">
																<el-select v-if="(form['task_allocation_id'] && $check_field('set','development_receiving')) || (!form['task_allocation_id'] && $check_field('add','development_receiving'))" id="development_receiving" v-model="form['development_receiving']" :disabled="disabledObj['development_receiving_isDisabled']">
							<el-option v-for="o in list_user_development_receiving" :key="o['username']" :label="o['nickname'] + '-' + o['username']"
									   :value="o['user_id']">
							</el-option>
						</el-select>
						<el-select v-else-if="$check_field('get','development_receiving')" id="development_receiving" v-model="form['development_receiving']" :disabled="true">
							<el-option v-for="o in list_user_development_receiving" :key="o['username']" :label="o['nickname'] + '-' + o['username']"
									   :value="o['user_id']">
							</el-option>
						</el-select>
											</el-form-item>
			</el-col>
								<el-col v-if="$check_field('get','test_receive') || $check_field('add','test_receive') || $check_field('set','test_receive')" :xs="24" :sm="12" :lg="8" class="el_form_item_warp">
							<el-form-item label="测试接收" prop="test_receive">
																<el-select v-if="(form['task_allocation_id'] && $check_field('set','test_receive')) || (!form['task_allocation_id'] && $check_field('add','test_receive'))" id="test_receive" v-model="form['test_receive']" :disabled="disabledObj['test_receive_isDisabled']">
							<el-option v-for="o in list_user_test_receive" :key="o['username']" :label="o['nickname'] + '-' + o['username']"
									   :value="o['user_id']">
							</el-option>
						</el-select>
						<el-select v-else-if="$check_field('get','test_receive')" id="test_receive" v-model="form['test_receive']" :disabled="true">
							<el-option v-for="o in list_user_test_receive" :key="o['username']" :label="o['nickname'] + '-' + o['username']"
									   :value="o['user_id']">
							</el-option>
						</el-select>
											</el-form-item>
			</el-col>
								<el-col v-if="$check_field('get','task_title') || $check_field('add','task_title') || $check_field('set','task_title')" :xs="24" :sm="12" :lg="8" class="el_form_item_warp">
							<el-form-item label="任务标题" prop="task_title">
															<el-input id="task_title" v-model="form['task_title']" placeholder="请输入任务标题"
							  v-if="(form['task_allocation_id'] && $check_field('set','task_title')) || (!form['task_allocation_id'] && $check_field('add','task_title'))" :disabled="disabledObj['task_title_isDisabled']"></el-input>
					<div v-else-if="$check_field('get','task_title')">{{form['task_title']}}</div>
											</el-form-item>
			</el-col>
								<el-col v-if="$check_field('get','task_type') || $check_field('add','task_type') || $check_field('set','task_type')" :xs="24" :sm="12" :lg="8" class="el_form_item_warp">
							<el-form-item label="任务类型" prop="task_type">
											<el-select id="task_type" v-model="form['task_type']"						v-if="(form['task_allocation_id'] && $check_field('set','task_type')) || (!form['task_allocation_id'] && $check_field('add','task_type'))">
						<el-option v-for="o in list_task_type" :key="o['task_type']" :label="o['task_type']"
							:value="o['task_type']">
						</el-option>
					</el-select>
					<div v-else-if="$check_field('get','task_type')">{{form['task_type']}}</div>
							</el-form-item>
			</el-col>
								<el-col v-if="$check_field('get','priority_level') || $check_field('add','priority_level') || $check_field('set','priority_level')" :xs="24" :sm="12" :lg="8" class="el_form_item_warp">
							<el-form-item label="优先等级" prop="priority_level">
											<el-select id="priority_level" v-model="form['priority_level']"
						v-if="(form['task_allocation_id'] && $check_field('set','priority_level')) || (!form['task_allocation_id'] && $check_field('add','priority_level'))">
						<el-option v-for="o in list_priority_level" :key="o" :label="o" :value="o">
						</el-option>
					</el-select>
					<div v-else-if="$check_field('get','priority_level')">{{form['priority_level']}}</div>
							</el-form-item>
			</el-col>
								<el-col v-if="$check_field('get','work_scale') || $check_field('add','work_scale') || $check_field('set','work_scale')" :xs="24" :sm="12" :lg="8" class="el_form_item_warp">
							<el-form-item label="工作量级" prop="work_scale">
											<el-select id="work_scale" v-model="form['work_scale']"
						v-if="(form['task_allocation_id'] && $check_field('set','work_scale')) || (!form['task_allocation_id'] && $check_field('add','work_scale'))">
						<el-option v-for="o in list_work_scale" :key="o" :label="o" :value="o">
						</el-option>
					</el-select>
					<div v-else-if="$check_field('get','work_scale')">{{form['work_scale']}}</div>
							</el-form-item>
			</el-col>
								<el-col v-if="$check_field('get','project_number') || $check_field('add','project_number') || $check_field('set','project_number')" :xs="24" :sm="12" :lg="8" class="el_form_item_warp">
							<el-form-item label="项目编号" prop="project_number">
															<el-input id="project_number" v-model="form['project_number']" placeholder="请输入项目编号"
							  v-if="(form['task_allocation_id'] && $check_field('set','project_number')) || (!form['task_allocation_id'] && $check_field('add','project_number'))" :disabled="disabledObj['project_number_isDisabled']"></el-input>
					<div v-else-if="$check_field('get','project_number')">{{form['project_number']}}</div>
											</el-form-item>
			</el-col>
								<el-col v-if="$check_field('get','entry_name') || $check_field('add','entry_name') || $check_field('set','entry_name')" :xs="24" :sm="12" :lg="8" class="el_form_item_warp">
							<el-form-item label="项目名称" prop="entry_name">
															<el-input id="entry_name" v-model="form['entry_name']" placeholder="请输入项目名称"
							  v-if="(form['task_allocation_id'] && $check_field('set','entry_name')) || (!form['task_allocation_id'] && $check_field('add','entry_name'))" :disabled="disabledObj['entry_name_isDisabled']"></el-input>
					<div v-else-if="$check_field('get','entry_name')">{{form['entry_name']}}</div>
											</el-form-item>
			</el-col>
								<el-col v-if="$check_field('get','start_time') || $check_field('add','start_time') || $check_field('set','start_time')" :xs="24" :sm="12" :lg="8" class="el_form_item_warp">
							<el-form-item label="开始时间" prop="start_time">
											<el-date-picker :disabled="disabledObj['start_time_isDisabled']" v-if="(form['task_allocation_id'] && $check_field('set','start_time')) || (!form['task_allocation_id'] && $check_field('add','start_time'))" id="start_time"
						v-model="form['start_time']" type="date" placeholder="选择日期" value-format="yyyy-MM-dd">
					</el-date-picker>
					<div v-else-if="$check_field('get','start_time')">{{form['start_time']}}</div>
							</el-form-item>
			</el-col>
								<el-col v-if="$check_field('get','task_deadline') || $check_field('add','task_deadline') || $check_field('set','task_deadline')" :xs="24" :sm="12" :lg="8" class="el_form_item_warp">
							<el-form-item label="任务截止" prop="task_deadline">
											<el-date-picker :disabled="disabledObj['task_deadline_isDisabled']" v-if="(form['task_allocation_id'] && $check_field('set','task_deadline')) || (!form['task_allocation_id'] && $check_field('add','task_deadline'))" id="task_deadline"
						v-model="form['task_deadline']" type="date" placeholder="选择日期" value-format="yyyy-MM-dd">
					</el-date-picker>
					<div v-else-if="$check_field('get','task_deadline')">{{form['task_deadline']}}</div>
							</el-form-item>
			</el-col>
								<el-col v-if="$check_field('get','task_status') || $check_field('add','task_status') || $check_field('set','task_status')" :xs="24" :sm="12" :lg="8" class="el_form_item_warp">
							<el-form-item label="任务状态" prop="task_status">
											<el-select id="task_status" v-model="form['task_status']"
						v-if="(form['task_allocation_id'] && $check_field('set','task_status')) || (!form['task_allocation_id'] && $check_field('add','task_status'))">
						<el-option v-for="o in list_task_status" :key="o" :label="o" :value="o">
						</el-option>
					</el-select>
					<div v-else-if="$check_field('get','task_status')">{{form['task_status']}}</div>
							</el-form-item>
			</el-col>
								<el-col v-if="$check_field('get','task_document') || $check_field('add','task_document') || $check_field('set','task_document')" :xs="24" :sm="12" :lg="8" class="el_form_item_warp">
							<el-form-item label="任务文档" prop="task_document">
															<div v-if="disabledObj['task_document_isDisabled']">
						<div v-if="$check_field('get','task_document')">
							<el-button type="primary" @click="$download($fullUrl(form['task_document']),form['task_document'])">下载<i
									class="el-icon-download el-icon--right"></i></el-button>
						</div>
					</div>
					<div v-else>
						<el-upload v-if="(form['task_allocation_id'] && $check_field('set','task_document')) || (!form['task_allocation_id'] && $check_field('add','task_document'))" class="upload-demo" drag
								   action="" style="max-width: 300px;width: 100%;" :http-request="upload_task_document" :limit="1" accept="">
							<i class="el-icon-upload"></i>
							<div class="el-upload__text">将文件拖到此处，或<em>点击上传</em></div>
						</el-upload>
						<div v-else-if="$check_field('get','task_document')">
							<el-button type="primary" @click="$download($fullUrl(form['task_document']),form['task_document'])">下载<i
									class="el-icon-download el-icon--right"></i></el-button>
						</div>
					</div>
											</el-form-item>
			</el-col>
								<el-col v-if="$check_field('get','code_repository') || $check_field('add','code_repository') || $check_field('set','code_repository')" :xs="24" :sm="12" :lg="8" class="el_form_item_warp">
							<el-form-item label="代码仓库" prop="code_repository">
															<el-input id="code_repository" v-model="form['code_repository']" placeholder="请输入代码仓库"
							  v-if="(form['task_allocation_id'] && $check_field('set','code_repository')) || (!form['task_allocation_id'] && $check_field('add','code_repository'))" :disabled="disabledObj['code_repository_isDisabled']"></el-input>
					<div v-else-if="$check_field('get','code_repository')">{{form['code_repository']}}</div>
											</el-form-item>
			</el-col>
								<el-col v-if="$check_field('get','test_tools') || $check_field('add','test_tools') || $check_field('set','test_tools')" :xs="24" :sm="12" :lg="8" class="el_form_item_warp">
							<el-form-item label="测试工具" prop="test_tools">
															<el-input id="test_tools" v-model="form['test_tools']" placeholder="请输入测试工具"
							  v-if="(form['task_allocation_id'] && $check_field('set','test_tools')) || (!form['task_allocation_id'] && $check_field('add','test_tools'))" :disabled="disabledObj['test_tools_isDisabled']"></el-input>
					<div v-else-if="$check_field('get','test_tools')">{{form['test_tools']}}</div>
											</el-form-item>
			</el-col>
								<el-col v-if="$check_field('get','allocate_time') || $check_field('add','allocate_time') || $check_field('set','allocate_time')" :xs="24" :sm="12" :lg="8" class="el_form_item_warp">
							<el-form-item label="分配时间" prop="allocate_time">
											<el-date-picker :disabled="disabledObj['allocate_time_isDisabled']" v-if="(form['task_allocation_id'] && $check_field('set','allocate_time')) || (!form['task_allocation_id'] && $check_field('add','allocate_time'))" id="allocate_time"
						v-model="form['allocate_time']" type="datetime" placeholder="选择日期时间">
					</el-date-picker>
					<div v-else-if="$check_field('get','allocate_time')">{{form['allocate_time']}}</div>
							</el-form-item>
			</el-col>
								<el-col v-if="$check_field('get','task_description') || $check_field('add','task_description') || $check_field('set','task_description')" :xs="24" :sm="12" :lg="8" class="el_form_item_warp">
							<el-form-item label="任务描述" prop="task_description">
											<el-input type="textarea" id="task_description" v-model="form['task_description']" placeholder="请输入任务描述"
						v-if="(form['task_allocation_id'] && $check_field('set','task_description')) || (!form['task_allocation_id'] && $check_field('add','task_description'))" :disabled="disabledObj['task_description_isDisabled']"></el-input>
					<div v-else-if="$check_field('get','task_description')">{{form['task_description']}}</div>
							</el-form-item>
			</el-col>
						
	
	
		
		
						<el-col :xs="24" :sm="12" :lg="8" class="el_form_item_warp" v-if="!form['source_user_id'] && 0 > 0">
			  <el-form-item label="消息推送限次">
				<el-input id="limit_times" v-model="form['message_push_limit_times']" placeholder="消息推送限制次数，0为不限"
						  v-if="$check_option('/task_allocation/view','can_limits')"
				></el-input>
				<div v-else-if="$check_action('/task_allocation/view','get')" v-html="form['message_push_limit_times']"></div>
			  </el-form-item>
			</el-col>
			
	
	
		
		
	
		</el-row>
			<el-col :xs="24" :sm="12" :lg="8" class="el_form_btn_warp">
				<el-form-item v-if="$check_action('/task_allocation/view','set') || $check_action('/task_allocation/view','add') || $check_option('/task_allocation/table','examine')">
					<el-button type="primary" @click="submit()">提交</el-button>
					<el-button @click="cancel()">取消</el-button>
				</el-form-item>
				<el-form-item v-else>
					<el-button @click="cancel()">返回</el-button>
				</el-form-item>
			</el-col>

		</el-form>
	</el-main>
</template>

<script>
	import mixin from "@/mixins/page.js";
	export default {
		mixins: [mixin],
		data() {
			return {
				field: "task_allocation_id",
				url_add: "~/api/task_allocation/add?",
				url_set: "~/api/task_allocation/set?",
				url_get_obj: "~/api/task_allocation/get_obj?",
				url_upload: "~/api/task_allocation/upload?",

				query: {
					"task_allocation_id": 0,
				},

				form: {
								"project_manager": 0, // 项目经理
										"development_receiving": 0, // 开发接收
										"test_receive": 0, // 测试接收
										"task_title":  '', // 任务标题
										"task_type":  '', // 任务类型
										"priority_level":  '', // 优先等级
										"work_scale":  '', // 工作量级
										"project_number":  '', // 项目编号
										"entry_name":  '', // 项目名称
										"start_time":  '', // 开始时间
										"task_deadline":  '', // 任务截止
										"task_status":  '', // 任务状态
										"task_document":  '', // 任务文档
										"code_repository":  '', // 代码仓库
										"test_tools":  '', // 测试工具
										"allocate_time":  '', // 分配时间
										"task_description":  '', // 任务描述
											"task_allocation_id": 0, // ID
													"message_push_limit_times": 0, // 消息推送限制次数
												},
				disabledObj:{
								"project_manager_isDisabled": false,
										"development_receiving_isDisabled": false,
										"test_receive_isDisabled": false,
										"task_title_isDisabled": false,
										"task_type_isDisabled": false,
										"priority_level_isDisabled": false,
										"work_scale_isDisabled": false,
										"project_number_isDisabled": false,
										"entry_name_isDisabled": false,
										"start_time_isDisabled": false,
										"task_deadline_isDisabled": false,
										"task_status_isDisabled": false,
										"task_document_isDisabled": false,
										"code_repository_isDisabled": false,
										"test_tools_isDisabled": false,
										"allocate_time_isDisabled": false,
										"task_description_isDisabled": false,
										},

	
					// 用户列表
				list_user_project_manager: [],
						// 用户组
				group_user_project_manager: "",
					
					// 用户列表
				list_user_development_receiving: [],
					
					// 用户列表
				list_user_test_receive: [],
					
									// 任务类型选项列表
				list_task_type: [""],
	
									// 优先等级选项列表
				list_priority_level: ['高','中','低'],
	
									// 工作量级选项列表
				list_work_scale: ['高','中','低'],
	
			
			
			
			
									// 任务状态选项列表
				list_task_status: ['未开始','进行中','待审核','已完成'],
	
			
			
			
			
			
		
			}
		},
		methods: {

	
	
				/**
			 * 获取项目经理用户列表
			 */
			async get_list_user_project_manager() {
                var json = await this.$get("~/api/user/get_list?user_group=项目经理");
                if(json.result && json.result.list){
                    this.list_user_project_manager = json.result.list;
                }
                else if(json.error){
                    console.error(json.error);
                }
			},
					/**
			 * 获取项目经理用户组
			 */
			async get_group_user_project_manager() {
							this.form["project_manager"] = this.user.user_id;
							var json = await this.$get("~/api/user_group/get_obj?name=项目经理");
				if(json.result && json.result.obj){
					this.group_user_project_manager = json.result.obj;
				}
				else if(json.error){
					console.error(json.error);
				}
			},
			get_user_session_project_manager(id){
				var _this = this;
				var user_id = {"user_id":id}
				var url = "~/api/"+_this.group_user_project_manager.source_table+"/get_obj?"
				this.$get(url, user_id, function(res) {
					if (res.result && res.result.obj) {
						var arr = []
						for (let key in res.result.obj) {
							arr.push(key)
						}
						var arrForm = []
									for (let key in _this.form) {
							arrForm.push(key)
						}
												_this.form["project_manager"] = id
									_this.disabledObj['project_manager' + '_isDisabled'] = true
						for (var i=0;i<arr.length;i++){
						  if (arr[i]!=='examine_state' && arr[i]!=='examine_reply') {
							for (var j = 0; j < arrForm.length; j++) {
							  if (arr[i] === arrForm[j]) {
								if (arr[i] !== "project_manager") {
			                      _this.form[arrForm[j]] = res.result.obj[arr[i]]
			                      _this.disabledObj[arrForm[j] + '_isDisabled'] = true
								  break;
								} else {
								  _this.disabledObj[arrForm[j] + '_isDisabled'] = true
								}
							  }
							}
						  }
						}
					}
				});
			},
					get_user_project_manager(id){
				var obj = this.list_user_project_manager.getObj({"user_id":id});
				var ret = "";
				if(obj){
					if(obj.nickname){
						ret = obj.nickname;}
					else{
						ret = obj.username;
					}
				}
				return ret;
			},
			
	
				/**
			 * 获取开发用户用户列表
			 */
			async get_list_user_development_receiving() {
                var json = await this.$get("~/api/user/get_list?user_group=开发用户");
                if(json.result && json.result.list){
                    this.list_user_development_receiving = json.result.list;
                }
                else if(json.error){
                    console.error(json.error);
                }
			},
					get_user_development_receiving(id){
				var obj = this.list_user_development_receiving.getObj({"user_id":id});
				var ret = "";
				if(obj){
					if(obj.nickname){
						ret = obj.nickname;}
					else{
						ret = obj.username;
					}
				}
				return ret;
			},
			
	
				/**
			 * 获取测试用户用户列表
			 */
			async get_list_user_test_receive() {
                var json = await this.$get("~/api/user/get_list?user_group=测试用户");
                if(json.result && json.result.list){
                    this.list_user_test_receive = json.result.list;
                }
                else if(json.error){
                    console.error(json.error);
                }
			},
					get_user_test_receive(id){
				var obj = this.list_user_test_receive.getObj({"user_id":id});
				var ret = "";
				if(obj){
					if(obj.nickname){
						ret = obj.nickname;}
					else{
						ret = obj.username;
					}
				}
				return ret;
			},
			
	
			
				/**
			 * 获取任务类型列表
			 */
			
						async get_list_task_type() {
				var json = await this.$get("~/api/task_type/get_list?");
				if(json.result && json.result.list){
					this.list_task_type = json.result.list;
				}
				else if(json.error){
					console.error(json.error);
				}
			},
								
			
	
			
	
			
	
			
	
			
	
			
	
			
	
						/**
			 * 上传任务文档
			 * @param {Object} param 文件参数
			 */
			upload_task_document(param){
									this.uploadFile(param.file, "task_document");
								},
	
	
			
	
			
	
			
	
			
	
		
			/**
			 * 获取对象之前
			 * @param {Object} param
			 */
			get_obj_before(param) {
				var form = "";
																											// 获取缓存数据附加
				form = $.db.get("form");
									$.push(this.form ,form);
																				
				if(this.form && form){
					Object.keys(this.form).forEach(key => {
						Object.keys(form).forEach(dbKey => {
							// if(dbKey === "charging_standard"){
							// 	this.form['charging_rules'] = form[dbKey];
							// 	this.disabledObj['charging_rules_isDisabled'] = true;
							// };
							if(key === dbKey){
								this.disabledObj[key+'_isDisabled'] = true;
								this.form[key] = form[dbKey]
							}
							if(dbKey === "source_table"){
								this.form['source_table'] = form[dbKey];
							}
							if(dbKey === "source_id"){
								this.form['source_id'] = form[dbKey];
							}
							if(dbKey === "source_user_id"){
								this.form['source_user_id'] = form[dbKey];
							}
						})
					})
				}
																				        if (this.form["start_time"] && this.form["start_time"].indexOf("-")===-1){
          this.form["start_time"] = this.$toTime(parseInt(this.form["start_time"]),"yyyy-MM-dd")
        }
			        if (this.form["task_deadline"] && this.form["task_deadline"].indexOf("-")===-1){
          this.form["task_deadline"] = this.$toTime(parseInt(this.form["task_deadline"]),"yyyy-MM-dd")
        }
										        if (this.form["allocate_time"] && this.form["allocate_time"].indexOf("-")===-1){
            this.form["allocate_time"] = this.$toTime(parseInt(this.form["allocate_time"]),"yyyy-MM-dd hh:mm:ss")
        }
								$.db.del("form");

				return param;
			},

			/**
			 * 获取对象之后
			 * @param {Object} json
			 * @param {Object} func
			 */
			get_obj_after(json, func){
																																																			if(this.form["start_time"]=="0000-00-00"){
				  this.form["start_time"] = null;
				}
				if(parseInt(this.form["start_time"]) > 9999){
					this.form["start_time"] = this.$toTime(parseInt(this.form["start_time"]),"yyyy-MM-dd")
				}
										if(this.form["task_deadline"]=="0000-00-00"){
				  this.form["task_deadline"] = null;
				}
				if(parseInt(this.form["task_deadline"]) > 9999){
					this.form["task_deadline"] = this.$toTime(parseInt(this.form["task_deadline"]),"yyyy-MM-dd")
				}
																													if(this.form["allocate_time"]=="0000-00-00 00:00:00"){
				  this.form["allocate_time"] = null;
				}
				if(parseInt(this.form["allocate_time"]) > 9999){
					this.form["allocate_time"] = this.$toTime(parseInt(this.form["allocate_time"]),"yyyy-MM-dd hh:mm:ss")
				}
										

			},

																																																																																																																																			async submit(param, func){
				if (!param) {
					param = this.form;
				}
						
				var pm = this.events("submit_before", Object.assign({}, param)) || param;
				var msg = await this.events("submit_check", pm);
				var ret;
				if (msg) {
					this.$toast(msg, 'danger');
				} else {
																																																																																																																															ret = this.events("submit_main", pm, func);
				}
				return ret;
			},
			
			/**
			 * 提交前验证事件
			 * @param {Object} 请求参数
			 * @return {String} 验证成功返回null, 失败返回错误提示
			 */
						submit_check(param) {
					
																																																																																																										if (!param.start_time){
					return "开始时间不能为空";
				}
																	if (!param.task_deadline){
					return "任务截止不能为空";
				}
																																																													if (!param.allocate_time){
					return "分配时间不能为空";
				}
																											return null;
			},

			is_view(){
				// var bl = this.user_group == "管理员";
				var bl = false;

				if(!bl){
					bl = this.$check_action('/task_allocation/table','add');
					console.log(bl ? "你有表格添加权限视作有添加权限" : "你没有表格添加权限");
				}
				if(!bl){
					bl = this.$check_action('/task_allocation/table','set');
					console.log(bl ? "你有表格添加权限视作有修改权限" : "你没有表格修改权限");
				}
				if(!bl){
					bl = this.$check_action('/task_allocation/view','add');
					console.log(bl ? "你有视图添加权限视作有添加权限" : "你没有视图添加权限");
				}
				if(!bl){
					bl = this.$check_action('/task_allocation/view','set');
					console.log(bl ? "你有视图修改权限视作有修改权限" : "你没有视图修改权限");
				}
				if(!bl){
					bl = this.$check_action('/task_allocation/view','get');
					console.log(bl ? "你有视图查询权限视作有查询权限" : "你没有视图查询权限");
				}

				console.log(bl ? "具有当前页面的查看权，请注意这不代表你有字段的查看权" : "无权查看当前页，请注意即便有字段查询权限没有页面查询权限也不行");

				return bl;
			},
			/**
			 * 上传文件
			 * @param {Object} param
			 */
			uploadimg(param) {
				this.uploadFile(param.file, "avatar");
			},

		},
		created() {
					this.get_list_user_project_manager();
					this.get_group_user_project_manager();
								this.get_list_user_development_receiving();
								this.get_list_user_test_receive();
									this.get_list_task_type();
																												},
	}
</script>

<style>
	.avatar-uploader .el-upload {
		border: 1px dashed #d9d9d9;
		border-radius: 6px;
		cursor: pointer;
		position: relative;
		overflow: hidden;
	}

	.avatar-uploader .el-upload:hover {
		border-color: #409EFF;
	}

	.avatar-uploader-icon {
		font-size: 28px;
		color: #8c939d;
		width: 178px;
		height: 178px;
		line-height: 178px;
		text-align: center;
	}

	.avatar {
		width: 178px;
		height: 178px;
		display: block;
	}
	
	.img_multiple{
		overflow: hidden;
	}
	.img_multiple .img_block{
		float: left;
		margin-right: 5px;
		margin-bottom: 5px;
		position: relative;
	}
	.img_multiple .img_block img{
		height: 100px;
		width: auto;
	}
	.img_multiple .img_del{
		position: absolute;
		top: 5px;
		right: 5px;
		width: 20px;
		height: 20px;
		background: #0000008a;
		color: #fff;
		line-height: 20px;
		text-align: center;
		border-radius: 100%;
		cursor: pointer;
	}




	
</style>
